package colony;

import java.util.List;

public class Item {

	public static int dimension;


	private List<Double> values;
	private String real;

	private int id;
	private Position pos;

	private boolean picked;

	public Item(List<Double> values, String real) {
		super();
		this.values = values;
		this.real = real;
		this.pos = new Position();
	}

	public double distanceEuclidean(Item item) {
		double distance = 0;

		for (int i = 0; i < values.size(); i++) {
			distance += Math.pow(values.get(i) - item.values.get(i), 2);
		}
		return Math.sqrt(distance);
	}

	public void setPosition(int x, int y) {
		pos.x = x;
		pos.y = y;
	}

	public Position getPosition() {
		return pos.clone();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public boolean isPicked() {
		return picked;
	}

	public void setPicked(boolean picked) {
		this.picked = picked;
	}

	public int getClasse() {
		if ("clust1_".equalsIgnoreCase(real)) {
			return 1;
		} else {
			if ("clust2_".equalsIgnoreCase(real)) {
				return 2;
			} else {
				return 3;
			}
		}
	}

	public void print() {
		if ("clust1_".equalsIgnoreCase(real)) {
			System.out.print(1);
		} else {
			if ("clust2_".equalsIgnoreCase(real)) {
				System.out.print(2);
			} else {
				System.out.print(3);
			}
		}
	}

}
